<%@page import="entities.ApplicationTemplate"%>
<%@page import="java.util.List"%>
<%@page import="entities.SiteConfig"%>
<%@page import="java.util.TreeMap"%>
<%@page import="helpers.UrlHelper"%>

<%
TreeMap<String, String> check = (TreeMap<String, String>) request.getAttribute("check");
SiteConfig configs = (SiteConfig) request.getAttribute("configs");
String form = (String) request.getAttribute("form");
List<ApplicationTemplate> templates = (List<ApplicationTemplate>) request.getAttribute("templates");
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/admin/layouts/header.jsp" />
		
<script type="text/javascript" src="/admin/js/custom/config_form.js"></script>
<script type="text/javascript">
<!--
var charset = "<%=configs.getHttpCharacterSet()%>";
var template = "<%=configs.getTemplate()%>";
jQuery(document).ready(function () {
	jQuery("select[name=httpCharacterSet]").val(charset);
	jQuery("select[name=template]").val(template);
});
//-->
</script>
		
					<!-- Content Area -->
                	<div id="da-content-area">
                		<jsp:include page="/admin/elements/message_box.jsp" />
                        
                		<div class="grid_4">
                        	<div class="da-panel">
                            	<div class="da-panel-header">
                                	<span class="da-panel-title">
                                        <img src="/admin/images/icons/black/16/pencil.png" alt="" />
                                        Site Config
                                    </span>
                                </div>
                                
                                <form class="da-form" method="post">
	                                <div class="da-panel-content">
	                                	<div class="da-form-inline">
                                    		<div class="da-form-row">
                                                <label>Site name <span class="required">*</span></label>
                                                <div class="da-form-item">
                                                    <input type="text" name="siteName" value="<%=configs.getSiteName() %>" class="<%=check.get("siteName") != null ? "error" : "" %>"/>
                                                    <% if (check.get("siteName") != null) { %>
                                                    <span class="errorMessage"><%=check.get("siteName") %></span>
                                                    <% } %>
                                                </div>
                                            </div>
                                            
                                            <div class="da-form-row">
                                                <label>Title <span class="required">*</span></label>
                                                <div class="da-form-item">
                                                    <input type="text" name="title" class="<%=check.get("title") != null ? "error" : "" %>" value="<%=configs.getTitle() %>" >
                                                    <% if (check.get("title") != null) { %>
                                                    <span class="errorMessage"><%=check.get("title") %></span>
                                                    <% } %>
                                                </div>
                                            </div>
                                            
                                            <div class="da-form-row">
                                                <label>META Keywords <span class="required">*</span></label>
                                                <div class="da-form-item large">
                                                     <textarea cols="auto" rows="auto" name="metaKeywords" class="<%=check.get("metaKeywords") != null ? "error" : "" %>" ><%=configs.getMetaKeywords() %></textarea>
                                                    <% if (check.get("metaKeywords") != null) { %>
                                                    <span class="errorMessage"><%=check.get("metaKeywords") %></span>
                                                    <% } %>
                                                </div>
                                            </div>
                                            
                                            <div class="da-form-row">
                                                <label>META Description <span class="required">*</span></label>
                                                <div class="da-form-item large">
                                                     <textarea cols="auto" rows="auto" name="metaDescription" class="<%=check.get("metaDescription") != null ? "error" : "" %>" ><%=configs.getMetaDescription() %></textarea>
                                                    <% if (check.get("metaDescription") != null) { %>
                                                    <span class="errorMessage"><%=check.get("metaDescription") %></span>
                                                    <% } %>
                                                </div>
                                            </div>
                                            
                                            <div class="da-form-row">
                                                <label>Templates</label>
                                                <div class="da-form-item">
                                                    <select name="template" class="<%=check.get("template") != null ? "error" : "" %>">
                                                    	<% for (int i = 0; i < templates.size(); i++) { %>
					                            		<option value="<%=templates.get(i).getId()%>" <%=templates.get(i).getId().equals(configs.getTemplate()) ? "selected=\"selected\"" : "" %>><%=templates.get(i).getTitle() %></option>
					                            		<% } %>
                                                    </select>
                                                    <% if (check.get("template") != null) { %>
                                                    <span class="errorMessage"><%=check.get("template") %></span>
                                                    <% } %>
                                                </div>
                                            </div>
                                            
                                            
                                            <div class="da-form-row">
                                                <label>Contact Email <span class="required">*</span></label>
                                                <div class="da-form-item">
                                                    <input type="text" name="contactEmail" class="<%=check.get("contactEmail") != null ? "error" : "" %>" value="<%=configs.getContactEmail() %>">
                                                    <% if (check.get("contactEmail") != null) { %>
                                                    <span class="errorMessage"><%=check.get("contactEmail") %></span>
                                                    <% } %>
                                                </div>
                                            </div>
                                            
                                            <div class="da-form-row">
                                                <label>Google Analytic Code</label>
                                                <div class="da-form-item large">
                                                     <textarea cols="auto" rows="auto" name="googleAnalyticCode" class="<%=check.get("googleAnalyticCode") != null ? "error" : "" %>" ><%=configs.getGoogleAnalyticCode() %></textarea>
                                                    <% if (check.get("googleAnalyticCode") != null) { %>
                                                    <span class="errorMessage"><%=check.get("googleAnalyticCode") %></span>
                                                    <% } %>
                                                </div>
                                            </div>
                                            
                                            <div class="da-form-row">
                                                <label>HTTP Character Set</label>
                                                <div class="da-form-item">
                                                	<select name="httpCharacterSet" class="<%=check.get("httpCharacterSet") != null ? "error" : "" %>">
                                                		<option value="ASMO-708" label="Arabic (ASMO 708) - ASMO-708">Arabic (ASMO 708) - ASMO-708</option>
														<option value="DOS-720" label="Arabic (DOS) - DOS-720">Arabic (DOS) - DOS-720</option>
														<option value="iso-8859-6" label="Arabic (ISO) - iso-8859-6">Arabic (ISO) - iso-8859-6</option>
														<option value="x-mac-arabic" label="Arabic (Mac) - x-mac-arabic">Arabic (Mac) - x-mac-arabic</option>
														<option value="windows-1256" label="Arabic (Windows) - windows-1256">Arabic (Windows) - windows-1256</option>
														<option value="ibm775" label="Baltic (DOS) - ibm775">Baltic (DOS) - ibm775</option>
														<option value="iso-8859-4" label="Baltic (ISO) - iso-8859-4">Baltic (ISO) - iso-8859-4</option>
														<option value="windows-1257" label="Baltic (Windows) - windows-1257">Baltic (Windows) - windows-1257</option>
														<option value="ibm852" label="Central European (DOS) - ibm852">Central European (DOS) - ibm852</option>
														<option value="iso" label="Central European (Mac) - x-mac-ce">Central European (Mac) - x-mac-ce</option>
														<option value="windows-1250" label="Central European (Windows) - windows-1250">Central European (Windows) - windows-1250</option>
														<option value="EUC-CN" label="Chinese Simplified (EUC) - EUC-CN">Chinese Simplified (EUC) - EUC-CN</option>
														<option value="gb2312" label="Chinese Simplified (GB2312) - gb2312">Chinese Simplified (GB2312) - gb2312</option>
														<option value="hz-gb-2312" label="Chinese Simplified (HZ) - hz-gb-2312">Chinese Simplified (HZ) - hz-gb-2312</option>
														<option value="x-mac-chinesesimp" label="Chinese Simplified (Mac) - x-mac-chinesesimp">Chinese Simplified (Mac) - x-mac-chinesesimp</option>
														<option value="big5" label="Chinese Traditional (Big5) - big5">Chinese Traditional (Big5) - big5</option>
														<option value="x-Chinese-CNS" label="Chinese Traditional (CNS) - x-Chinese-CNS">Chinese Traditional (CNS) - x-Chinese-CNS</option>
														<option value="x-Chinese-Eten" label="Chinese Traditional (Eten) - x-Chinese-Eten">Chinese Traditional (Eten) - x-Chinese-Eten</option>
														<option value="x-mac-chinesetrad" label="Chinese Traditional (Mac) - x-mac-chinesetrad">Chinese Traditional (Mac) - x-mac-chinesetrad</option>
														<option value="cp866" label="Cyrillic (DOS) - cp866">Cyrillic (DOS) - cp866</option>
														<option value="iso-8859-5" label="Cyrillic (ISO) - iso-8859-5">Cyrillic (ISO) - iso-8859-5</option>
														<option value="koi8-r-8859-2" label="Central European (ISO) - iso-8859-2">Central European (ISO) - iso-8859-2</option>
														<option value="x-mac-ce" label="Cyrillic (KOI8-R) - koi8-r">Cyrillic (KOI8-R) - koi8-r</option>
														<option value="koi8-u" label="Cyrillic (KOI8-U) - koi8-u">Cyrillic (KOI8-U) - koi8-u</option>
														<option value="x-mac-cyrillic" label="Cyrillic (Mac) - x-mac-cyrillic">Cyrillic (Mac) - x-mac-cyrillic</option>
														<option value="windows-1251" label="Cyrillic (Windows) - windows-1251">Cyrillic (Windows) - windows-1251</option>
														<option value="x-Europa" label="Europa - x-Europa">Europa - x-Europa</option>
														<option value="x-IA5-German" label="German (IA5) - x-IA5-German">German (IA5) - x-IA5-German</option>
														<option value="ibm737" label="Greek (DOS) - ibm737">Greek (DOS) - ibm737</option>
														<option value="iso-8859-7" label="Greek (ISO) - iso-8859-7">Greek (ISO) - iso-8859-7</option>
														<option value="x-mac-greek" label="Greek (Mac) - x-mac-greek">Greek (Mac) - x-mac-greek</option>
														<option value="windows-1253" label="Greek (Windows) - windows-1253">Greek (Windows) - windows-1253</option>
														<option value="ibm869" label="Greek, Modern (DOS) - ibm869">Greek, Modern (DOS) - ibm869</option>
														<option value="DOS-862" label="Hebrew (DOS) - DOS-862">Hebrew (DOS) - DOS-862</option>
														<option value="iso-8859-8-i" label="Hebrew (ISO-Logical) - iso-8859-8-i">Hebrew (ISO-Logical) - iso-8859-8-i</option>
														<option value="iso-8859-8" label="Hebrew (ISO-Visual) - iso-8859-8">Hebrew (ISO-Visual) - iso-8859-8</option>
														<option value="x-mac-hebrew" label="Hebrew (Mac) - x-mac-hebrew">Hebrew (Mac) - x-mac-hebrew</option>
														<option value="windows-1255" label="Hebrew (Windows) - windows-1255">Hebrew (Windows) - windows-1255</option>
														<option value="ibm861" label="Icelandic (DOS) - ibm861">Icelandic (DOS) - ibm861</option>
														<option value="x-mac-icelandic" label="Icelandic (Mac) - x-mac-icelandic">Icelandic (Mac) - x-mac-icelandic</option>
														<option value="x-iscii-as" label="ISCII Assamese - x-iscii-as">ISCII Assamese - x-iscii-as</option>
														<option value="x-iscii-be" label="ISCII Bengali - x-iscii-be">ISCII Bengali - x-iscii-be</option>
														<option value="x-iscii-de" label="ISCII Devanagari - x-iscii-de">ISCII Devanagari - x-iscii-de</option>
														<option value="x-iscii-gu" label="ISCII Gujarathi - x-iscii-gu">ISCII Gujarathi - x-iscii-gu</option>
														<option value="x-iscii-ka" label="ISCII Kannada - x-iscii-ka">ISCII Kannada - x-iscii-ka</option>
														<option value="x-iscii-ma" label="ISCII Malayalam - x-iscii-ma">ISCII Malayalam - x-iscii-ma</option>
														<option value="x-iscii-or" label="ISCII Oriya - x-iscii-or">ISCII Oriya - x-iscii-or</option>
														<option value="x-iscii-pa" label="ISCII Panjabi - x-iscii-pa">ISCII Panjabi - x-iscii-pa</option>
														<option value="x-iscii-ta" label="ISCII Tamil - x-iscii-ta">ISCII Tamil - x-iscii-ta</option>
														<option value="x-iscii-te" label="ISCII Telugu - x-iscii-te">ISCII Telugu - x-iscii-te</option>
														<option value="euc-jp" label="Japanese (EUC) - euc-jp">Japanese (EUC) - euc-jp</option>
														<option value="iso-2022-jp" label="Japanese (JIS) - iso-2022-jp">Japanese (JIS) - iso-2022-jp</option>
														<option value="csISO2022JP" label="Japanese (JIS-Allow 1 byte Kana) - csISO2022JP">Japanese (JIS-Allow 1 byte Kana) - csISO2022JP</option>
														<option value="x-mac-japanese" label="Japanese (Mac) - x-mac-japanese">Japanese (Mac) - x-mac-japanese</option>
														<option value="shift_jis" label="Japanese (Shift-JIS) - shift_jis">Japanese (Shift-JIS) - shift_jis</option>
														<option value="ks_c_5601-1987" label="Korean - ks_c_5601-1987">Korean - ks_c_5601-1987</option>
														<option value="euc-kr" label="Korean (EUC) - euc-kr">Korean (EUC) - euc-kr</option>
														<option value="iso-2022-kr" label="Korean (ISO) - iso-2022-kr">Korean (ISO) - iso-2022-kr</option>
														<option value="Johab" label="Korean (Johab) - Johab">Korean (Johab) - Johab</option>
														<option value="x-mac-korean" label="Korean (Mac) - x-mac-korean">Korean (Mac) - x-mac-korean</option>
														<option value="iso-8859-3" label="Latin 3 (ISO) - iso-8859-3">Latin 3 (ISO) - iso-8859-3</option>
														<option value="iso-8859-15" label="Latin 9 (ISO) - iso-8859-15">Latin 9 (ISO) - iso-8859-15</option>
														<option value="x-IA5-Norwegian" label="Norwegian (IA5) - x-IA5-Norwegian">Norwegian (IA5) - x-IA5-Norwegian</option>
														<option value="IBM437" label="OEM United States - IBM437">OEM United States - IBM437</option>
														<option value="x-IA5-Swedish" label="Swedish (IA5) - x-IA5-Swedish">Swedish (IA5) - x-IA5-Swedish</option>
														<option value="windows-874" label="Thai (Windows) - windows-874">Thai (Windows) - windows-874</option>
														<option value="ibm857" label="Turkish (DOS) - ibm857">Turkish (DOS) - ibm857</option>
														<option value="iso-8859-9" label="Turkish (ISO) - iso-8859-9">Turkish (ISO) - iso-8859-9</option>
														<option value="x-mac-turkish" label="Turkish (Mac) - x-mac-turkish">Turkish (Mac) - x-mac-turkish</option>
														<option value="windows-1254" label="Turkish (Windows) - windows-1254">Turkish (Windows) - windows-1254</option>
														<option value="unicode" label="Unicode - unicode">Unicode - unicode</option>
														<option value="unicodeFFFE" label="Unicode (Big-Endian) - unicodeFFFE">Unicode (Big-Endian) - unicodeFFFE</option>
														<option value="utf-7" label="Unicode (UTF-7) - utf-7">Unicode (UTF-7) - utf-7</option>
														<option value="utf-8" label="Unicode (UTF-8) - utf-8">Unicode (UTF-8) - utf-8</option>
														<option value="us-ascii" label="US-ASCII - us-ascii">US-ASCII - us-ascii</option>
														<option value="windows-1258" label="Vietnamese (Windows) - windows-1258">Vietnamese (Windows) - windows-1258</option>
														<option value="ibm850" label="Western European (DOS) - ibm850">Western European (DOS) - ibm850</option>
														<option value="x-IA5" label="Western European (IA5) - x-IA5">Western European (IA5) - x-IA5</option>
														<option value="iso-8859-1" label="Western European (ISO) - iso-8859-1">Western European (ISO) - iso-8859-1</option>
														<option value="macintosh" label="Western European (Mac) - macintosh">Western European (Mac) - macintosh</option>
														<option value="Windows-1252" label="Western European (Windows) - Windows-1252">Western European (Windows) - Windows-1252</option>
                                                	</select>
                                                    <% if (check.get("httpCharacterSet") != null) { %>
                                                    <span class="errorMessage"><%=check.get("httpCharacterSet") %></span>
                                                    <% } %>
                                                </div>
                                            </div>
                                            
                                            <div class="da-form-row">
                                                <label>Google Custom Search Id</label>
                                                <div class="da-form-item">
                                                    <input type="text" name="cxGoogleSearch" class="<%=check.get("cxGoogleSearch") != null ? "error" : "" %>" value="<%=configs.getGoogleAnalyticCode() %>">
                                                    <% if (check.get("cxGoogleSearch") != null) { %>
                                                    <span class="errorMessage"><%=check.get("cxGoogleSearch") %></span>
                                                    <% } %>
                                                </div>
                                            </div>
                                            
                                            <div class="da-form-row">
                                                <label>Logo Url</label>
                                                <div class="da-form-item">
                                                    <input type="text" name="logo" class="<%=check.get("logo") != null ? "error" : "" %>" value="<%=configs.getLogo() %>">
                                                    <% if (check.get("logo") != null) { %>
                                                    <span class="errorMessage"><%=check.get("logo") %></span>
                                                    <% } %>
                                                </div>
                                            </div>
                                            
                                            <div class="da-form-row">
                                                <label>Cache Prefix Name</label>
                                                <div class="da-form-item">
                                                    <input type="text" name="cachePrefix" class="<%=check.get("cachePrefix") != null ? "error" : "" %>" value="<%=configs.getCachePrefix() %>">
                                                    <% if (check.get("cachePrefix") != null) { %>
                                                    <span class="errorMessage"><%=check.get("cachePrefix") %></span>
                                                    <% } %>
                                                </div>
                                            </div>
                                            
                                            <div class="da-button-row">
			                                   	<input type="submit" value="Submit" class="da-button blue left" />
			                                	<input type="reset" value="Reset" class="da-button gray" />
			                                </div>
	                                    </div>
	                                	
	                                </div>
                                </form>
                                
                                
                            </div>
                        </div>
                        
                	</div>

<jsp:include page="/admin/layouts/footer.jsp" />